package lormi.meipin.controller.api;

import lormi.meipin.annotation.NotValidUser;
import lormi.meipin.annotation.RegClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import lormi.meipin.common.Result;
import lormi.meipin.controller.BaseController;
import lormi.meipin.exception.LMException;

import javax.validation.constraints.NotNull;


@RestController
@RequestMapping(value="v2/system",method=RequestMethod.POST,produces = "application/json; charset=utf-8")
public class SystemController extends BaseController{

	/**
	 * 获取版本和更新信息
	 * */
	@NotValidUser
	@RequestMapping("")
	public String select() throws LMException{
		return Result.success(systemInfoService.getVersionUpdate());
	}


    /**
     * 注册客户端
     * @Param client 客户端的默认key
     * */
    @RegClient
    @RequestMapping("client")
    public String client(@NotNull(message="100033") @RequestParam(value="client",required=false)String client) throws LMException{
        return Result.success(systemInfoService.regClient(client));
    }
	
	
}
